/*
	 * @Descripttion:报修接口API
	 * @Author:JDW
	 * @version:
	 */
import { requestUrl } from '@/common/util/request.ts';

import { workflowList } from './comAPI.ts'

/***
 * @function 分页查询报修申请列表
 * @params 请求参数
 */

export function repairApplyList(params: {}) {
	return requestUrl({
		url: `/assetExecDtl`,
		data: params,
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 报修详情
export function repairDetail(params: string) {
	return requestUrl({
		url: `/assetExecDtl/${params}`,
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 实施
export function repairExec(params: {}) {
	return requestUrl({
		url: `/assetExecDtl/exec`,
		method: 'put',
		keyWord: 'assets',
		data: params,
		isJson: true
	})
}
// 确认完成
export function repairConfirm(params: [{}]) {
	return requestUrl({
		url: `/assetExecDtl/confirmation`,
		method: 'put',
		keyWord: 'assets',
		data: params,
		isJson: true
	})
}
// 查询图片
export function viewPhoto(params: string) {
	return requestUrl({
		url: `/common/sysEncl/${params}`,
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 枚举
export function getStatus(params: string) {
	return requestUrl({
		url: `/enums/${params}`,
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 提交报修申请
export function submitRepair(params: {}) {
	return requestUrl({
		url: `/assetApply/apply`,
		method: 'post',
		keyWord: 'assets',
		data: params,
		isJson: true
	})
}
export async function submitRepair2(params) {
	const subCode = await workflowList()
	return requestUrl({
		url: `/assetApply/submit`,
		method: 'put',
		keyWord: 'assets',
		data: {
			applySubCode: subCode.data[0].subCode,
			businessDatas: params
		},
		isJson: true
	})
}